package com.deyuanyun.pic.pipe.controller.vo;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.common.util.format.NumberFormat;
import com.deyuanyun.pic.pipe.domain.PiggingStructure;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.util.ArrayList;
import java.util.List;

/**
 * 收发球筒
 */
public class PiggingStructureVO extends BaseVO<PiggingStructure> {

    // 管道名称
    private String pipeLineName;
    // 收发球筒编号
    private String piggingstructureNumber;
    // 所属场站阀室
    private String pipeValveRoomName;
    // 压力等级（Mpa）
    private String pressureRating;
    // 小球筒长度（mm）
    private String sbarrelLength;
    // 小球筒直径（mm）
    private String sbarrelDiameter;
    // 小球筒壁厚（mm）
    private String sbarrelWallThickness;
    // 大球筒长度（mm）
    private String bbarrelLength;
    // 大球筒直径（mm）
    private String bbarrelDiameter;
    // 大球筒壁厚（mm）
    private String bbarrelWallThickness;
    // 行政地域名称
    private String adminRegionName;
    // 生产厂商
    private String manufacturer;
    // 生成日期
    private String manufacturedDate;
    // 链接计算结果表
    private String gisId;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getPiggingstructureNumber() {
        return piggingstructureNumber;
    }

    public void setPiggingstructureNumber(String piggingstructureNumber) {
        this.piggingstructureNumber = piggingstructureNumber;
    }

    public String getPipeValveRoomName() {
        return pipeValveRoomName;
    }

    public void setPipeValveRoomName(String pipeValveRoomName) {
        this.pipeValveRoomName = pipeValveRoomName;
    }

    public String getPressureRating() {
        return pressureRating;
    }

    public void setPressureRating(String pressureRating) {
        this.pressureRating = pressureRating;
    }

    public String getSbarrelLength() {
        return sbarrelLength;
    }

    public void setSbarrelLength(String sbarrelLength) {
        this.sbarrelLength = sbarrelLength;
    }

    public String getSbarrelDiameter() {
        return sbarrelDiameter;
    }

    public void setSbarrelDiameter(String sbarrelDiameter) {
        this.sbarrelDiameter = sbarrelDiameter;
    }

    public String getSbarrelWallThickness() {
        return sbarrelWallThickness;
    }

    public void setSbarrelWallThickness(String sbarrelWallThickness) {
        this.sbarrelWallThickness = sbarrelWallThickness;
    }

    public String getBbarrelLength() {
        return bbarrelLength;
    }

    public void setBbarrelLength(String bbarrelLength) {
        this.bbarrelLength = bbarrelLength;
    }

    public String getBbarrelDiameter() {
        return bbarrelDiameter;
    }

    public void setBbarrelDiameter(String bbarrelDiameter) {
        this.bbarrelDiameter = bbarrelDiameter;
    }

    public String getBbarrelWallThickness() {
        return bbarrelWallThickness;
    }

    public void setBbarrelWallThickness(String bbarrelWallThickness) {
        this.bbarrelWallThickness = bbarrelWallThickness;
    }

    public String getAdminRegionName() {
        return adminRegionName;
    }

    public void setAdminRegionName(String adminRegionName) {
        this.adminRegionName = adminRegionName;
    }

    public String getManufacturer() {
        return manufacturer;
    }

    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }

    public String getManufacturedDate() {
        return manufacturedDate;
    }

    public void setManufacturedDate(String manufacturedDate) {
        this.manufacturedDate = manufacturedDate;
    }

    public String getGisId() {
        return gisId;
    }

    public void setGisId(String gisId) {
        this.gisId = gisId;
    }

    public void fromDomain(PiggingStructure domain) {

        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }
        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 收发球筒编号
        this.piggingstructureNumber = domain.getPiggingstructureNumber();
        // 所属场站阀室
        this.pipeValveRoomName = PipeLineUtil.getValveRoomName(domain.getPipeValveroomId());
        // 压力等级（Mpa）
        this.pressureRating = NumberFormat.format(domain.getPressureRating());
        // 小球筒长度（mm）
        this.sbarrelLength = NumberFormat.format(domain.getSbarrelLength());
        // 小球筒直径（mm）
        this.sbarrelDiameter = NumberFormat.format(domain.getSbarrelDiameter());
        // 小球筒壁厚（mm）
        this.sbarrelWallThickness = NumberFormat.format(domain.getSbarrelWallThickness());
        // 大球筒长度（mm）
        this.bbarrelLength = NumberFormat.format(domain.getBbarrelLength());
        // 大球筒直径（mm）
        this.bbarrelDiameter = NumberFormat.format(domain.getBbarrelDiameter());
        // 大球筒壁厚（mm）
        this.bbarrelWallThickness = NumberFormat.format(domain.getBbarrelWallThickness());
        // 行政地域名称
        this.adminRegionName = domain.getAdminRegionName();
        // 生产厂商
        this.manufacturer = domain.getManufacturer();
        // 生成日期
        this.manufacturedDate = DateFormat.format(domain.getManufacturedDate());
        // gis地址
        this.gisId = domain.getGisId();

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordtime(), domain.getCreateRemark());
    }

    public Page<PiggingStructureVO> fromDomainList(Page<PiggingStructure> domainList) {
        Page<PiggingStructureVO> list = new Page<PiggingStructureVO>();
        for (PiggingStructure piggingStructure : domainList) {
            PiggingStructureVO piggingStructureVO = new PiggingStructureVO();
            piggingStructureVO.fromDomain(piggingStructure);
            list.add(piggingStructureVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }

}